<% content_for :googlemaps do %>
  <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
  <script type="text/javascript">
    var stockholm = new google.maps.LatLng(10.463536424076864, -66.97718103149418);
    var parliament = new google.maps.LatLng(10.463536424076864, -66.97718103149418);
    var marker;
    var map;
    var point;

    function initialize() {
      var mapOptions = {
        zoom: 14,
        mapTypeId: google.maps.MapTypeId.ROADMAP,
        center: stockholm
      };

      map = new google.maps.Map(document.getElementById("map_canvas"),
      mapOptions);

      marker = new google.maps.Marker({
        map:map,
        draggable:true,
        animation: google.maps.Animation.DROP,
        icon: "/images/machine32.png",
        position: parliament
      });
      google.maps.event.addListener(marker, 'click', toggleBounce);
      google.maps.event.addListener(marker, 'dragend', coordinates);
    }

    function toggleBounce() {
      if (marker.getAnimation() != null) {
        marker.setAnimation(null);
      } else {
        marker.setAnimation(google.maps.Animation.BOUNCE);
      }
    }

    function coordinates() {
      var point = new google.maps.LatLng(marker.getPosition().lat(),marker.getPosition().lng(),true);
      map.panTo(point);
      document.getElementById("machine_latitude").value = point.lat();
      document.getElementById("machine_longitude").value = point.lng();
    }

  </script>
<% end %>
<h2 align="center" class="ourCompany-hdr"><%= t('machine.edit') %></h2>
<% form_for(@machine) do |f| %>
  <%= f.error_messages %>

 <table aling="center" width="200" border="1" cellspacing="2" cellpadding="2">
   <tr align="center">
                <th align="left" scope="row"><img src="/images/star.png" width="32" height="32" /></th>
	        <th align="left" nowrap="nowrap"><%= t('machine.status') %>: </th>
	        <td> <%= f.text_field :status %></td>
        </tr>
	      <tr>
	        <th align="left" scope="row">&nbsp;</th>
	        <th align="left" nowrap="nowrap"><%= t('machine.state') %>: </th>
	        <td><%= f.text_field :state %></td>
        </tr>
	      <tr>
	        <th align="left" scope="row">&nbsp;</th>
	        <th align="left" nowrap="nowrap"><%= t('machine.zone') %>: </th>
	        <td><%= f.text_field :zone %></td>
        </tr>
	      <tr>
	        <th align="left" scope="row">&nbsp;</th>
	        <th align="left" nowrap="nowrap"><%= t('machine.model') %>: </th>
	        <td><%= f.text_field :model %></td>
        </tr>
              <tr>
	        <th align="left" scope="row">&nbsp;</th>
	        <th align="left" nowrap="nowrap"><%= t('machine.brand') %>: </th>
	        <td><%= f.text_field :brand %></td>
        </tr>
              <tr>
	        <th align="left" scope="row">&nbsp;</th>
	        <th align="left" nowrap="nowrap"><%= t('machine.version') %>: </th>
	        <td><%= f.text_field :version %></td>
        </tr>
              <tr>
	        <th align="left" scope="row">&nbsp;</th>
	        <th align="left" nowrap="nowrap"><%= t('machine.os') %>: </th>
	        <td><%= f.text_field :os %></td>
        </tr>
              <tr>
	        <th align="left" scope="row">&nbsp;</th>
	        <th align="left" nowrap="nowrap"><%= t('machine.disc') %>: </th>
	        <td><%= f.text_field :disc %></td>
        </tr>
              <tr>
	        <th align="left" scope="row">&nbsp;</th>
	        <th align="left" nowrap="nowrap"><%= t('machine.memory') %>: </th>
	        <td><%= f.text_field :ram %></td>
        </tr>
              <tr>
	        <th align="left" scope="row">&nbsp;</th>
	        <th align="left" nowrap="nowrap"><%= t('machine.procesor') %>: </th>
	        <td><%= f.text_field :processor %></td>
        </tr>
             
              <tr>
	        <th align="left" scope="row">&nbsp;</th>
	        <th align="left" nowrap="nowrap"><%= t('machine.max') %>: </th>
	        <td><%= f.text_field :cant_ap %></td>
        </tr>
              <tr>
	        <th align="left" scope="row">&nbsp;</th>
	        <th align="left" nowrap="nowrap"><%= t('machine.admin') %>: </th>
	        <td><%= f.text_field :administrator_id %></td>
               
        </tr>
         <tr>
      <td><%= link_to image_tag("/images/back.png", :title => t('machine.back'), :border=>0), machines_path %></td>
                <td><%= image_submit_tag("/images/update.png", :title => t('machine.edit'), :border=>0) %></td>

    </tr>
                 <tr>
            <th align="left" scope="row">&nbsp;</th>
            
      <th><%= f.hidden_field :latitude, :readonly =>true %></th>
      <td rowspan="8"><div  id="map_canvas" style="width:250px; height:250px"> </div></td>
       


    </tr>
               
      </table>
<% end %>